class X1bar3ma:
    def __init__(self,ma=["ma5","ma10"]):
        self.ma=ma
    def oncalc(self, b,timekey=None):
        rst=0
        isc=True
        h=b["high"]
        l=b["low"]
        for i in self.ma:
            if b[i]:
                if b[i]<l or b[i]>h:
                    isc=False
                    break
        if isc:
            if b["close"]>b["open"]:
                rst=2
            elif b["close"]<b["open"]:
                rst=-2
        return rst

